package com.lzs.chuku.controller.other;

import com.lzs.chuku.service.other.WardService;
import com.lzs.entity.Warehouse;
import com.lzs.util.R;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 小刘先生
 * @date 2020/12/11 15:27
 */
@RestController
@RequestMapping("/chuku/ward")
public class WardhourseCon {
    @Autowired
    private WardService wardService;
    @PostMapping("findWarebyids")
    @ApiOperation("根据仓库id查询仓库信息")
    public R findWarebyids(HttpServletRequest request){
        String wardhourseids = request.getHeader("warehouseId");
        String[] split = wardhourseids.split(",");
        List list=new ArrayList();
        for (int i = 0; i <split.length ; i++) {
            Warehouse warehouse = wardService.findBYid(split[i]);
            list.add(warehouse);
        }
        return R.ok().data("list",list);
    }
}
